package models

import (
	"bytes"
	"fmt"
	"github.com/astaxie/beego"
	"os/exec"
)


func GetNameAndPassword()(username string,password string){
	username ="renjie59420"
	password = "rj123456"

	return username,password
}




//经过测试 可以执行windows 命令
func ExecCmd(execCmd string){
	cmd := exec.Command("cmd")
	// cmd := exec.Command("powershell")
	in := bytes.NewBuffer(nil)
	cmd.Stdin = in //绑定输入
	var out bytes.Buffer
	cmd.Stdout = &out //绑定输出
	go func() {
		// start stop restart
		in.WriteString(execCmd) //写入你的命令，可以有多行，"\n"表示回车
	}()
	err := cmd.Start()
	if err != nil {
		beego.Debug(err)
	}
	beego.Debug(cmd.Args)
	err = cmd.Wait()
	if err != nil {
		beego.Debug("Command finished with error: %v", err)
	}
	rt := out.String() //mahonia.NewDecoder("gbk").ConvertString(out.String()) //
	fmt.Println(rt)

}

